// This structure represents xv6's file system blocks.
struct buf {
  // track the relationship between memory and disk.
  int flags;
  uint dev;
  uint blockno;
  struct sleeplock lock;
  uint refcnt;
  struct buf *prev; // LRU cache list
  struct buf *next;
  struct buf *qnext; // disk queue
  // BSIZE identical to IDE's sector size.
  // data[] is the in-memory copy of the disk sector.
  uchar data[BSIZE];
};
// used by buf.flags
#define B_VALID 0x2  // buffer has been read from disk
#define B_DIRTY 0x4  // buffer needs to be written to disk

